package org.boot.wxipad.support.api.impl;

import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
import org.apache.hc.core5.http.HttpHost;
import org.boot.wxipad.common.util.http.HttpType;
import org.boot.wxipad.common.util.http.apache.ApacheHttpClientBuilder;
import org.boot.wxipad.common.util.http.apache.DefaultApacheHttpClientBuilder;

/**
 * @author liyuncong
 * @version 1.0
 * @file WxIpadServiceRestTemplateImpl
 * @brief 微信IPAD服务RestTemplate实现
 * @details 微信IPAD服务RestTemplate实现
 * @date 2024-08-05
 *
 * Edit History
 * ----------------------------------------------------------------------------
 * DATE                     NAME               DESCRIPTION
 * 2024-08-05               liyuncong          Created
 */
public class WxIpadServiceApacheHttpClientImpl extends BaseWxIpadServiceImpl<CloseableHttpClient, HttpHost> {
    private CloseableHttpClient httpClient;
    private HttpHost httpHost;

    @Override
    public CloseableHttpClient getRequestHttpClient() {
        return httpClient;
    }

    @Override
    public HttpHost getRequestHttpProxy() {
        return httpHost;
    }

    @Override
    public HttpType getRequestType() {
        return HttpType.APACHE_HTTP;
    }

    @Override
    public void initHttp() {
        ApacheHttpClientBuilder apacheHttpClientBuilder = DefaultApacheHttpClientBuilder.builder();

        // if client has httpProxy, set proxy
        httpClient = apacheHttpClientBuilder.build();
    }
}
